/**
 * 普通房间游戏操作类
 * @author LuoDong
 * @eamil luo4521@online.net.tw
 */
function normalGameEvent()
{
	
}

normalGameEvent.prototype.handleFun = function(r_room, r_user, r_type, r_bet) {			
	if ( r_type != '' ) {
		//trace("function:" + r_type);				
		return this[r_type](r_room, r_user, r_bet);
	}
}

/**
 * 确定庄家,第一局游戏开始，第一个坐下的玩家为庄家
 */
normalGameEvent.prototype.checkBanker = function(r_room) {
	var _users = r_room.getAllPlayes();
	var _num = _users.length;
	if (_num == 1) {
		var _banker = _users.pop();
		r_room.properties.put("banker",  _banker.getPlayerIndex());  	//设置庄家
	}
}

/**
 * 游戏开始，执行初始化
 */
normalGameEvent.prototype.gameStart = function(r_room)
{		
	
	var _poker = new poker();	//实例化扑克牌	
	_poker.remove([ { 'label':'BLACK_JOKER', 'value':0, 'suit':'NULL' }, { 'label':'RED_JOKER', 'value':0, 'suit':'NULL' } ]); //移除大鬼，小鬼
	_poker.shuffle();  //洗牌	
	var _public_poker = _poker.deal(5);	//公共牌
	var _users_poker  = { };	
	var _players = r_room.getAllPlayers();  	//獲取游戲玩家
	var _sit;
	for each(var _user in _players) {		
		_sit = _user.getPlayerIndex();		//获取玩家座位号
		if(_sit >0){
			_users_poker[_user.getPlayerIndex()] = _poker.deal(2); //從撲克實例中取出兩張撲克牌		
		}
	}	
	
	r_room.properties.put("pubPoker",  _public_poker);  	//公共牌
	r_room.properties.put("userPoker", _users_poker );   //玩家私有牌
	r_room.properties.put("banker", 0 );  		//庄家位置
	r_room.properties.put("call", { } )			//当前叫牌玩家对象，User
	r_room.properties.put("pot",  [])			//池底数组	
	
}

normalGameEvent.prototype.formatPoker = function()
{
	
}
